﻿using System;
using System.Collections.Generic;
using Beeldbankmvc.Models;
using System.Web.Mvc;

namespace Beeldbankmvc.ViewModels
{
    public class SearchViewModel
    {
        public int? selectedCollectionId { get; set; }
        public int? selectedStatusId { get; set; }
        public int numberOfNew { get; set; }
        public int numberOfRejected { get; set; }
        public int numberOfReadyForPublish { get; set; }
        public int numberOfPublishedExternal { get; set; }
        public int numberOfPublishedInternal { get; set; }
        public int numberOfHidden { get; set; }
        public int numberOfNoThumbNail { get; set; }
        public int numberOfNoMapNumber { get; set; }
        public int NumberOfResults { get; set; }
        public int numberOfNewUnknown { get; set; }
        public int numberOfEditUnknown { get; set; }
        public List<BEELDBANK_MEDIAOBJECT> mediaobjects { get; set; }
        public SelectList CollectionId { get; private set; }
        public SelectList StatusId { get; private set; }
        public String currentUserName { get; set; }
        public String currentUserEmail { get; set; }
        public bool CanBeEditedByCurrentUser { get; set; }
        public SelectList UserId { get; private set; }
        
        public SearchViewModel()
        {
            CollectionRepository collectionRepository = new CollectionRepository();
            var allTypes = collectionRepository.FindAllSortedByName();
            CollectionId = new SelectList(allTypes, "Id", "Name");

            StatusRepository statusRepository = new StatusRepository();
            var allStatuses = statusRepository.FindAll();
            StatusId = new SelectList(allStatuses, "Id", "Name");

            PublishRightsRepository publishRepository = new PublishRightsRepository();
            var allUsers = publishRepository.getRedactieUserList();
            UserId = new SelectList(allUsers, "Name", "Name");
        }

        // facets resulting from search stored procedure
        public List<BEELDBANK_MEDIAOBJECT_FACETS_REGIO> RegioFacets { get; set; }
        public List<BEELDBANK_MEDIAOBJECT_FACETS_TECHNIEK> TechniekFacets { get; set; }
        public List<BEELDBANK_MEDIAOBJECT_FACETS_RIVIERGEBIED> RivierGebiedFacets { get; set; }
        public List<BEELDBANK_MEDIAOBJECT_FACETS_PROJECT> ProjectFacets { get; set; }
        public List<BEELDBANK_TYPE> TypeFacets { get; set; }
        public List<BEELDBANK_MEDIAOBJECT_FACETS_RESULT> YearFacets { get; set; }
        public List<BEELDBANK_COLLECTION> ThemaFacets { get; set; }

        // facets
        public List<BEELDBANK_MEDIAOBJECT_FACETS_REGIO> RegioFacetsAll { get; set; }
        public List<BEELDBANK_MEDIAOBJECT_FACETS_TECHNIEK> TechniekFacetsAll { get; set; }
        public List<BEELDBANK_MEDIAOBJECT_FACETS_RIVIERGEBIED> RivierGebiedFacetsAll { get; set; }
        public List<BEELDBANK_MEDIAOBJECT_FACETS_PROJECT> ProjectFacetsAll { get; set; }
        public List<BEELDBANK_TYPE> TypeFacetsAll { get; set; }
        public List<String> YearFacetsAll { get; set; }
        public List<BEELDBANK_COLLECTION> ThemaFacetsAll { get; set; }

    }
}